package com.atguigu.day02;

import org.apache.flink.api.common.typeinfo.Types;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class Example7 {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);

        env
                .fromElements(1)
                .map(r -> Tuple2.of(r, r))
                // 类型擦除
                // Tuple2<Integer, Integer> -> Tuple2<Object, Object>
                .returns(
                        Types.TUPLE(
                                Types.INT,
                                Types.INT
                        )
                )
                .print();

        env.execute();
    }
}
